package edu.taru.service.impl;

import edu.taru.mapper.UserMapper;
import edu.taru.pojo.User;
import edu.taru.util.ReadExcel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
@Service
public class UpListUserImpl {

    @Autowired
    UserMapper userMapper;

    //批量导入客户
    public boolean batchImport(String name, MultipartFile file){
        boolean b = false;
        //创建处理EXCEL
        ReadExcel readExcel=new ReadExcel();
        //解析excel，获取客户信息集合。
        List<User> users = readExcel.getExcelInfo(name ,file);
        if(users != null){
            b = true;
        }
        userMapper.insertList(users);
        return b;
    }
}
